package com.qf.bank.userapi.api;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.bank.userapi.fallback.UsersApiError;
import com.qf.bank.userapi.po.UserCardInfo;
import com.qf.bank.userapi.po.Users;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: bank
 * @description:
 * @author: 徐毫杰
 * @create: 2019-12-03 14:09
 */
@FeignClient(value = "user-provider", fallback = UsersApiError.class)
public interface UsersApi {
  //        用户分页
  @RequestMapping(value = "/", method = RequestMethod.GET)
  public Page<Users> page(@RequestParam int current, @RequestParam int size);

  //    查询单个用户
  @RequestMapping(value = "/{userId}", method = RequestMethod.GET)
  public Users getById(@PathVariable(value = "userId") int userId);

  @RequestMapping(value = "/{userId}/cardInfo", method = RequestMethod.GET)
  UserCardInfo selectCardInfoByUserId(@PathVariable int userId);
  //     根据电话号查用户信息
  @RequestMapping(value = "/list", method = RequestMethod.GET)
  public List<Users> getList(@RequestBody String userPhone);
  /** 　* @描述: 用户登录验证 　* @时间: 2019/12/5 13:30 　 */
  @RequestMapping(value = "/login", method = RequestMethod.POST)
  public Users getSelectLogin(@RequestBody Users users);

  /** 　* @描述: 添加用户 　* @时间: 2019/12/5 13:32 　 */
  @RequestMapping(value = "/", method = RequestMethod.POST)
  public Boolean setInsert(@RequestBody Users users);

  /** 　* @描述: 根据用户id删除用户 　* @时间: 2019/12/5 13:50 　 */
  @RequestMapping(value = "/{userId}", method = RequestMethod.DELETE)
  public Boolean getDeleteId(@PathVariable(value = "userId") int userId);

  /** 　* @描述: 删除多个用户 　* @时间: 2019/12/5 13:53 　 */
  @RequestMapping(value = "/", method = RequestMethod.DELETE)
  public Boolean getDelete(@RequestBody List<Integer> list);

  /** 　* @描述: 根据用户id修改用户信息(修改部分信息) 　* @时间: 2019/12/5 13:51 　 */
  @RequestMapping(value = "/", method = RequestMethod.PATCH)
  public Boolean getChangeId(@RequestBody Users users);
}
